//
//  ImgButton.m
//  PotentialTraining
//
//  Created by admin on 2018/2/23.
//  Copyright © 2018年 admin. All rights reserved.
//

#import "ImgButton.h"

@implementation ImgButton

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        [self addSubview:self.bgView];
//        [self setBackgroundImage:self.bgImg forState:UIControlStateNormal];
//        [self setBackgroundImage:self.bgImg forState:UIControlStateSelected];
    }
    return self;
}

- (UIView *)bgView{
    if (_bgView == nil) {
        _bgView = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, (kScreenWidth/2-100)/4, (kScreenWidth/2-100)/4)];
        _bgView.backgroundColor = kAlphaColor(0, 0, 0, 0.4);
        _bgView.clipsToBounds = YES;
        _bgView.layer.cornerRadius = 8;
    }
    return _bgView;
}

@end
